SPB Git

Repository Public

route.ts 798 B 14 lines typescript

1import { getCourse, getDeck } from "@/lib/content";2import { env } from "@/lib/env";3import { serveDeckAsset } from "@/lib/slides-serve";45export const dynamic = "force-dynamic";67/** Slide images of published decks: /diapositives/<session>/<deck>/<theme>/<nnn>.svg and thumbnails. */8async function handle(request: Request, { params }: { params: Promise<{ path: string[] }> }) {9  const path = (await params).path, session = (await getCourse()).sessions.find((s) => s.id === path[0]);10  // The deck is read through the public view: a session whose slides are not published has none, and answers 404.11  return serveDeckAsset(session ? await getDeck(session) : null, path, request, env.mode === "preview" ? "private, no-store" : "public, max-age=86400");12}13export { handle as GET, handle as HEAD };14
Files main
Menu

Theme